package Building;

import General.Terrain;

public class allBuildings {
	private boolean[] buildingList = new boolean[13];
/*	private boolean wall=false;//0
	private boolean tower=false;//1
	private boolean storeHouse=false;//2
	private boolean market=false;//3
	private boolean armory=false;//4
	private boolean quarry=false;//5
	private boolean monument=false;//6
	private boolean granary=false;//7
	private boolean goldMint=false;//8
	private boolean woodWorkshop=false;//9
	private boolean siegeEngine=false;//10
	private boolean greatTemple=false;//11
	private boolean wonder=false;//12*/
	private int MAX_HOUSE=10;
	private int numberBuilding=0;
	private int MAX_BUILDING=16;
	private int house=0;//13
	
	//constructor
	public allBuildings(){
		//TODO what to do here?
		super();
	}
	
	public boolean searchOtherBuildings(int buildingCode){
		return buildingList[buildingCode];
	}
	
	public boolean buildValid(int no){
		if (numberBuilding+no>MAX_BUILDING) return false;
		return true;
	}
	public void setNumberBuilding(int num){
		numberBuilding += num;
	}
	
	public boolean buildHouse(int num){
		int numBuild;
		if (house==MAX_HOUSE) return false;
		if (house+num>MAX_HOUSE){
			numBuild = MAX_HOUSE - house;
			house = MAX_HOUSE;
			
		}
		else {
			numBuild = num;
			house += numBuild;
		}
		if (buildValid(numBuild)) {setNumberBuilding(numBuild); return true;}
		else return false;
	}
	public boolean buildotherBuilding(int buildingCode){
		if (buildValid(1)&&buildingList[buildingCode]==false){
			buildingList[buildingCode]=true;
			setNumberBuilding(1);
			return true;
		}
		return false;
	}

	public int getHouseCount(){
		return house;
	}
	public int getBuildingCount(){
		return numberBuilding;
	}
	public String toString(){
		String[] names = {"Wall", "Tower", "Storehouse", "Market", "Armory", "Quarry", "Monumnent","Granary","Gold Mint", "Wood Workshop", "Siege Engine Workshop", "Great Temple", "Wonder"};
		String out = "";
		for(int i = 0; i< 13; i++){
			if(buildingList[i]){
				out+=names[i];
			}
		}
		return out+" Houses: "+house;
	}
/*		public boolean buildWall(){
		if (buildValid(1)&&(wall==false)) {wall=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildTower(){
		if (buildValid(1)&&(tower==false)) {tower=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildStoreHouse(){
		if (buildValid(1)&&(storeHouse==false)) {storeHouse=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildMarket(){
		if (buildValid(1)&&(market==false)) {market=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildArmory(){
		if (buildValid(1)&&(armory==false)) {armory=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildQuarry(){
		if (buildValid(1)&&(quarry==false)) {quarry=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildMonument(){
		if (buildValid(1)&&(monument==false)) {monument=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildGranary(){
		if (buildValid(1)&&(granary==false)) {granary=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildGoldMint(){
		if (buildValid(1)&&(goldMint==false)) {goldMint=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildWoodWorkshop(){
		if (buildValid(1)&&(woodWorkshop==false)) {woodWorkshop=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildSiegeEngine(){
		if (buildValid(1)&&(siegeEngine==false)) {siegeEngine=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildGreatTemple(){
		if (buildValid(1)&&(greatTemple==false)) {greatTemple=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean buildWonder(){
		if (buildValid(1)&&(wonder==false)) {wonder=true; setNumberBuilding(1); return true;}
		return false;
	}
	public boolean getWall(){
		return wall;
	}
	public boolean getTower(){
		return tower;
	}
	public boolean getStoreHouse(){
		return storeHouse;
	}
	public boolean getMarket(){
		return market;
	}
	public boolean getArmory(){
		return armory;
	}
	public boolean getQuarry(){
		return quarry;
	}
	public boolean getMonument(){
		return monument;
	}
	public boolean getGranary(){
		return granary;
	}
	public boolean getGoldMint(){
		return goldMint;
	}
	public boolean getWoodWorkshop(){
		return woodWorkshop;
	}
	public boolean getSiegeEngine(){
		return siegeEngine;
	}
	public boolean getGreatTemple(){
		return greatTemple;
	}
	public boolean getWonder(){
		return wonder;
	}*/
}
